﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.Master" AutoEventWireup="true" CodeBehind="PhotoList.aspx.cs" Inherits="Token.Piker.Web.Admin.Album.PhotoList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>组图管理</title>
    <style type="text/css">
        .img_holder {
            display: block;
            width: 200px;
            height: 200px;
            margin: 0 5px 5px 0;
            overflow: hidden;
            border: 1px solid #ccc;
            float: left;
        }
    </style>
    <script src="../../js/fancyapps-fancyBox/lib/jquery-1.9.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        //以下封装对图片进行处理
        function DrawImage(img, W, H) {
            var width = $(img).width();
            var height = $(img).height();
            if (width / height >= W / H) {
                if (width > W) {
                    $(img).height(H);
                    width = width * H / height;
                    $(img).width(width);
                    var margin = (W - width) / 2;
                    $(img).css("margin-left", margin).css("margin-right", margin);
                }
            } else {
                if (height > H) {
                    $(img).width(W);
                    height = height * W / width;
                    $(img).height(height);
                    var margin = (H - height) / 2;
                    $(img).css("margin-top", margin).css("margin-bottom", margin);
                }
            }
        }
        $(document).ready(function () {
            $(".img_holder img").load(function () {
                DrawImage(this, 200, 200);
            });
        });    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:DataList ID="dataList" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal">
        <ItemTemplate>
            <a class="img_holder" href="Show.aspx?ID=<%# Eval("ID").ToString() %>" title="点击查看图片详细信息">
                <img src="<%# ResolveClientUrl(string.Format("~/AJAX/Thumbnail.ashx?pid={0}&width=200&height=200",Eval("ID"))) %>" alt="" /></a>
        </ItemTemplate>
    </asp:DataList>
</asp:Content>
